import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("role", { schema: "alumni" })
export class Role {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("int", { name: "creator_id", unsigned: true, default: () => "'0'" })
  creatorId: number;

  @Column("varchar", { name: "name", length: 30 })
  name: string;

  @Column("tinyint", { name: "target", comment: "针对谁的", default: () => "'0'" })
  target: 0|1;

  @Column("tinyint", { name: "belong", comment: "归属", default: () => "'0'" })
  belong: number;

  @Column("json", { name: "menus", nullable: true, comment: "权限菜单集合" })
  menus: number[];

  @Column("varchar", { name: "remark", length: 100 })
  remark: string;

  @Column("boolean", {
    name: "enable",
    comment: "是否启用",
  })
  enable: boolean;

  @Column("int", { name: "sort", unsigned: true, default: () => "'0'" })
  sort: number;

  @Column("int", { name: "create_time", default: () => "'0'" })
  createTime: number;

  @Column("int", { name: "update_time", default: () => "'0'" })
  updateTime: number;
}
